package com.jiazhong.mingxing.project.bookstore.front.controller;

import com.jiazhong.mingxing.project.bookstore.commons.util.JsonResult;
import com.jiazhong.mingxing.project.bookstore.front.service.BookService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/book")
public class BookController {
    @Resource
    private BookService bookService;

    @GetMapping("/find_lower_price_book")
    public JsonResult findLowerPriceBook() {
        return bookService.findLowerPriceBook(4);
    }

    @GetMapping("/find_more_books_category")
    public JsonResult findMoreBooksByCategoryId(@RequestParam("category_id") String categoryId) {
        return bookService.findMoreBooksByCategoryId(categoryId);
    }

    @GetMapping("/find_more_books_name")
    public JsonResult findMoreBooksByBookName(@RequestParam("book_name") String bookName) {
        return bookService.findMoreBooksByBookName(bookName);
    }
}
